package com.aust.test;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class MainRunThisMethod {
    public static void main(String[] args) throws Exception {
        Class<TestRunThisMethod> testRunThisMethodClass = TestRunThisMethod.class;
        for (Method method : testRunThisMethodClass.getMethods()) {
            if (method.isAnnotationPresent(RunThisMethod.class)) {
                RunThisMethod annotation = method.getAnnotation(RunThisMethod.class);
                if (annotation.enabled()) {
                    Constructor<TestRunThisMethod> declaredConstructor = testRunThisMethodClass.getDeclaredConstructor();
                    TestRunThisMethod testRunThisMethod = declaredConstructor.newInstance();
                    method.invoke(testRunThisMethod);
                }
            }
        }
    }
}
